class Person {
    public readonly name:string;  // 字符串 只读
    name2:string

    constructor(name:string){
        this.name = name
        this.name2 = name
    }
    setName(name:string) {
        // this.name = name // Cannot assign to 'name' because it is a read-only property.
        this.name2 = name; // ok
    }
}
const name3 = new Person('pengyuyan')
console.log(name3)     // Person: {"name": "pengyuyan", "name2": "pengyuyan"}
console.log(name3.name2)  // pengyuyan
console.log(name3.name)  // pengyuyan
